package tech.aistar.mapper;

import org.apache.ibatis.annotations.*;
import tech.aistar.pojo.Attraction;

import java.util.List;

@Mapper
public interface AttractionMapper {
    @Select("select * from attraction where name=#{name}")
    List<Attraction> getByName(String name);

    @Select("select * from attraction")
    List<Attraction> getAll();

    @Select("select * from attraction where location like concat('%',#{location}, '%')")
    List<Attraction> getListByLocation(String location);

    @Delete("delete from attraction where id=#{value}")
    int delById(Integer id);

    @Insert("insert into attraction(name,location,open_time,close_time,status) values(#{name},#{location},#{openTime},#{closeTime},#{status})")
    int save(Attraction attraction);

    @Update("update attraction set location=#{location},open_time=#{openTime},close_time=#{closeTime},status=#{status} where name=#{name}")
    int update(Attraction attraction);

    @Select("select * from attraction where location=#{location}")
    List<Attraction> getByLocation(String location);


}
